<template>
    <div v-if="loading" class="loading-overlay">
        <div class="loading-spinner">
            <div class="ring" style="border-color: red;"></div>
            <div class="ring" style="border-color: green;"></div>
            <div class="ring" style="border-color: blue;"></div>
        </div>
    </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
    name: 'Loading',
    props: {
        loading: {
            type: Boolean,
            default: false,
        },
    },
});
</script>

<style scoped>
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
}

.ring {
    width: 60px;
    height: 60px;
    border: 6px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 5px;
}

.ring:nth-child(1) {
    animation-delay: 0s;
}

.ring:nth-child(2) {
    animation-delay: 0.2s;
}

.ring:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
</style>
